﻿@using NetCoreCMS.Models;
@using NetCoreCMS.Common;
@{
    Layout = "~/Areas/admin/Views/Shared/_LayoutEdit.cshtml";
    ViewBag.Title = "编辑会员";
    Users m = ViewData["model"] as Users;
    User_login_log logModel = ViewData["logModel"] as User_login_log;
    string defaultpassword = ViewBag.defaultpassword as string;
    List<SelectListItem> groupListItems = ViewData["groupListItems"] as List<SelectListItem>;
}

@section HeaderContent{
    <script>
        $(function () {
            //初始化表单验证
            $("#form1").initValidform();
            //初始化上传控件
            $(".upload-img").InitUploader({ sendurl: "/upload_ajax/index", swf: "/scripts/webuploader/uploader.swf" });
        });
    </script>
}
<form id="form1" method="post" action="SubmitSave?action=@ViewBag.Action&id=@ViewBag.Id">
    <!--导航栏-->
    <div class="location">
        <a href="../user_list/index" class="back"><i class="iconfont icon-up"></i><span>返回列表页</span></a>
        <a href="../center/index"><i class="iconfont icon-home"></i><span>首页</span></a>
        <i class="arrow iconfont icon-arrow-right"></i>
        <a href="../user_list/index"><span>会员管理</span></a>
        <i class="arrow iconfont icon-arrow-right"></i>
        <span>编辑会员</span>
        <div class="clipboard">
            <span><label id="clipMess"></label></span>
            <a href="javascript:;" class="copy" onclick="copy();"><i class="iconfont icon-copy"></i><span>复制</span></a>
            <a href="javascript:;" class="paste disable" onclick="paste();"><i class="iconfont icon-log"></i><span>粘贴</span></a>
        </div>
    </div>
    <div class="line10"></div>
    <!--/导航栏-->
    <!--内容-->
    <div id="floatHead" class="content-tab-wrap">
        <div class="content-tab">
            <div class="content-tab-ul-wrap">
                <ul>
                    <li><a class="selected" href="javascript:;">基本资料</a></li>
                    <li><a href="javascript:;">账户信息</a></li>
                </ul>
            </div>
        </div>
    </div>

    <div class="tab-content">
        <dl>
            <dt>所属组别</dt>
            <dd>
                <div class="rule-single-select">
                    @Html.DropDownList("ddlGroupId", new SelectList(groupListItems, "Value", "Text", m.group_id), new { datatype = "*", errormsg = "请选择组别", sucmsg = " " })
                </div>
            </dd>
        </dl>
        <dl>
            <dt>用户状态</dt>
            <dd>
                <div class="rule-multi-radio">
                    <span id="rplStatus">
                        @Html.RadioButton("rblStatus", 0, m.status == 0, new { id = "rblStatus_0" })<label for="rblStatus_0">正常</label>
                        @Html.RadioButton("rblStatus", 1, m.status == 1, new { id = "rblStatus_1" })<label for="rblStatus_1">待验证</label>
                        @Html.RadioButton("rblStatus", 2, m.status == 2, new { id = "rblStatus_2" })<label for="rblStatus_2">待审核</label>
                        @Html.RadioButton("rblStatus", 3, m.status == 3, new { id = "rblStatus_3" })<label for="rblStatus_3">禁用</label>
                    </span>
                </div>
                <span class="Validform_checktip">*禁用账户无法登录</span>
            </dd>
        </dl>
        <dl>
            <dt>用户名</dt>
            <dd>
                @if ((ViewBag.Action as string) == CMSEnums.ActionEnum.Edit.ToString())
                {
                    @Html.TextBox("txtUserName", m.user_name, new { @class = "input normal", @readonly = true, datatype = "*2-100", sucmsg = " " })
                }
                else
                {
                    @Html.TextBox("txtUserName", m.user_name, new { @class = "input normal", datatype = "*2-100", sucmsg = " ", ajaxurl = "/Admin/Admin_Ajax?action=username_validate" })
                }

                <span class="Validform_checktip">*登录的用户名，支持中文</span>
            </dd>
        </dl>
        <dl>
            <dt>登录密码</dt>
            <dd>
                @Html.Password("txtPassword", m.password, new { @class = "input normal", datatype = "*6-20", nullmsg = "密码范围在6-20位之间", sucmsg = " " })
                <span class="Validform_checktip">*登录的密码，至少6位</span>
            </dd>
        </dl>
        <dl>
            <dt>确认密码</dt>
            <dd>
                @Html.Password("txtPassword1", m.password, new { @class = "input normal", datatype = "*", recheck = "txtPassword", nullmsg = "请再输入一次密码", errormsg = "两次输入的密码不一致", sucmsg = " " })
                <span class="Validform_checktip">*再次输入密码</span>
            </dd>
        </dl>
        <dl>
            <dt>邮箱账号</dt>
            <dd>
                @Html.TextBox("txtEmail", m.email, new { @class = "input normal", datatype = "*0-50", sucmsg = " " })
                <span class="Validform_checktip">*取回密码时用到</span>
            </dd>
        </dl>
        <dl>
            <dt>用户昵称</dt>
            <dd>
                @Html.TextBox("txtNickName", m.nick_name, new { @class = "input normal" })
            </dd>
        </dl>
        <dl>
            <dt>上传头像</dt>
            <dd>
                @Html.TextBox("txtAvatar", m.avatar, new { @class = "input normal upload-path" })
                <div class="upload-box upload-img"></div>
            </dd>
        </dl>
        <dl>
            <dt>用户性别</dt>
            <dd>
                <div class="rule-multi-radio">
                    <span id="rblSex">
                        @Html.RadioButton("rblSex", "保密", m.sex == "保密", new { id = "rblSex_0" })<label for="rblSex_0">保密</label>
                        @Html.RadioButton("rblSex", "男", m.sex == "男", new { id = "rblSex_1" })<label for="rblSex_1">男</label>
                        @Html.RadioButton("rblSex", "女", m.sex == "女", new { id = "rblSex_2" })<label for="rblSex_2">女</label>
                    </span>
                </div>
            </dd>
        </dl>
        <dl>
            <dt>生日日期</dt>
            <dd>
                @Html.TextBox("txtBirthday", m.birthday != null ? m.birthday.GetValueOrDefault().ToString("yyyy-M-d") : "", new { @class = "input rule-date-input", onfocus = "WdatePicker({dateFmt:'yyyy-MM-dd'})", datatype = @"/^\s*$|^\d{4}\-\d{1,2}\-\d{1,2}$/", errormsg = "请选择正确的日期", sucmsg = " " })
            </dd>
        </dl>
        <dl>
            <dt>手机号码</dt>
            <dd>
                @Html.TextBox("txtMobile", m.mobile, new { @class = "input normal" })
            </dd>
        </dl>
        <dl>
            <dt>电话号码</dt>
            <dd>
                @Html.TextBox("txtTelphone", m.telphone, new { @class = "input normal" })
            </dd>
        </dl>
        <dl>
            <dt>QQ号码</dt>
            <dd>
                @Html.TextBox("txtQQ", m.qq, new { @class = "input normal" })
            </dd>
        </dl>
        <dl>
            <dt>MSN</dt>
            <dd>
                @Html.TextBox("txtMsn", m.msn, new { @class = "input normal" })
            </dd>
        </dl>
        <dl>
            <dt>通讯地址</dt>
            <dd>
                @Html.TextBox("txtAddress", m.address, new { @class = "input normal" })
            </dd>
        </dl>
    </div>

    <div class="tab-content" style="display:none;">
        <dl>
            <dt>账户金额</dt>
            <dd>
                @Html.TextBox("txtAmount", m.amount, new { @class = "input small", datatype = @"/^(([1-9]{1}\d*)|([0]{1}))(\.(\d){1,2})?$/", sucmsg = " " }) 元
                <span class="Validform_checktip">*账户上的余额</span>
            </dd>
        </dl>
        <dl>
            <dt>账户积分</dt>
            <dd>
                @Html.TextBox("txtPoint", m.point, new { @class = "input small", datatype = "n", sucmsg = " " }) 分
                <span class="Validform_checktip">*积分也可做为交易</span>
            </dd>
        </dl>
        <dl>
            <dt>升级经验值</dt>
            <dd>
                @Html.TextBox("txtExp", m.exp, new { @class = "input small", datatype = "n", sucmsg = " " })
                <span class="Validform_checktip">*根据积分计算得来，与积分不同的是只增不减</span>
            </dd>
        </dl>
        <dl>
            <dt>注册时间</dt>
            <dd>
                <label id="lblRegtime">@(m.id > 0 ? m.reg_time.ToString("yyyy-MM-dd") : "")</label>
            </dd>
        </dl>
        <dl>
            <dt>注册IP</dt>
            <dd>
                <label id="lblRegIP">@(m.id > 0 ? m.reg_ip : "")</label>
            </dd>
        </dl>
        <dl>
            <dt>最近登录时间</dt>
            <dd>
                <label id="lblLastTime">
                    @(logModel == null ? "-" : logModel.login_time.ToString("yyyy-MM-dd"))
                </label>
            </dd>
        </dl>
        <dl>
            <dt>最近登录IP</dt>
            <dd>
                <label id="lblLastIP">
                    @(logModel == null ? "-" : logModel.login_ip)
                </label>
            </dd>
        </dl>
    </div>
    <!--/内容-->
    <!--工具栏-->
    <div class="page-footer">
        <div class="btn-wrap">
            <input type="submit" class="btn" value="提交保存" />
            <input name="btnReturn" type="button" value="返回上一页" class="btn yellow" onclick="javascript: history.back(-1);" />
        </div>
    </div>
    <!--/工具栏-->

</form>